fix(plan): allow correlated update target subqueries - #26605
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed the exact new head. The previous two blockers are closed: target qualifiers now come only from the modified table occurrences, so a read-only self-join alias cannot grant the exemption; CROSS APPLY table-function arguments are included in correlation analysis with left-side shadowing preserved. I also checked the surrounding nested JOIN/UNION/wrapper/local-shadow cases and found no new reachable violation. Focused compatibility tests passed at count=20, the full pkg/sql/plan suite passed, and go list/build/vet plus diff-check were clean.
Merge Queue Status
This pull request spent 39 minutes 22 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26605 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #26548
What this PR does / why we need it:
The MySQL 1093 compatibility check treated every direct read of an UPDATE target table inside a subquery as an uncorrelated self-read. This regressed the correlated UPDATE behavior previously verified in #24824.
This change makes the check scope-aware:
The check remains planner-only and adds no execution-path overhead.
Validation:
GOWORK=off go list -mod=readonly ./pkg/sql/planGOWORK=off go build -mod=readonly ./pkg/sql/planGOWORK=off go vet -mod=readonly ./pkg/sql/plangolangci-lint run -c .golangci.yml ./pkg/sql/plan/....agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s ./pkg/sql/plan176/218 = 80.73%